home *** CD-ROM | disk | FTP | other *** search
- #ifndef XPKMASTER_SUBLIBS_C
- #define XPKMASTER_SUBLIBS_C
-
- /* Routinesheader
-
- Name: sublibs.c
- Main: xpkmaster
- Versionstring: $VER: sublibs.c 1.0 (09.10.96)
- Author: SDI
- Distribution: PD
- Description: Handling of xpksublibraries
-
- 1.0 09.10.96 : first real version
- */
-
- #include <pragma/exec_lib.h>
- #include <exec/types.h>
- #include <dos/dos.h>
- #include "xpkmaster.h"
- #include "xpk_strings.h"
-
- /************************* open sublib from ID ***************************/
- struct Library *opensub(struct XpkBuffer *xbuf, ULONG ID)
- {
- UBYTE libname[] = "compressors/xpk____.library";
- struct Library *XpkSubBase;
-
- /* Do nothing if we already have what we want */
- if((xbuf->xb_SubBase) && (xbuf->xb_SubID == ID))
- return xbuf->xb_SubBase;
-
- closesub(xbuf);
-
- xbuf->xb_SubID = ID;
- CopyMem((STRPTR) &ID, libname+15, 4);
-
- if(!(XpkSubBase = OpenLibrary(libname, 0)))
- xbuf->xb_Result = XPKERR_MISSINGLIB;
- else if((xbuf->xb_SubInfo = XpksPackerInfo())->xi_MasterVersion > MainVersion)
- {
- xbuf->xb_Result = XPKERR_OLDMASTLIB;
- closesub(xbuf);
- }
- return(xbuf->xb_SubBase = XpkSubBase);
- }
-
- /*********************** close any open sub-library *********************/
- void closesub(struct XpkBuffer *xbuf)
- {
- if(xbuf->xb_SubBase)
- {
- #ifdef DEBUG
- DebugRunTime("closesub: closing lib %.4s", &xbuf->xb_SubID);
- #endif
- CloseLibrary(xbuf->xb_SubBase);
- xbuf->xb_SubBase = NULL;
- }
- }
-
- #endif /* XPKMASTER_SUBLIBS_C */
-